package cn.lzm.controller;

import cn.lzm.AjaxResult;
import cn.lzm.domain.Store;
import cn.lzm.server.IStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/store")
public class StoreController {
    @Autowired
    private IStoreService productService;
    @PostMapping
    public AjaxResult addOne(@RequestBody Store store){
       return productService.addOne(store);
    }
    @GetMapping("/selectByProductId/{id}")
    public Store selectByProductId(@PathVariable("id") Long id){
        return productService.selectByProductId(id);
    }
    @GetMapping
    public List<Store> selectAll(){
        List<Store> stores = productService.selectAll();
        return stores;
    }

}
